#include "opencv2/opencv.hpp"
#include <iostream>
#include <vector>
#include "net.h"

/**
 * @descriptor:使用logistic回归
 * @note:
 * @author: modmvp
 * @date: 2021-01-18
 * @version: 10.0.2
*/

int main(void){
    ncnn::Net net;
    net.load_param("../../model/logistic.param");
    net.load_model("../../model/logistic.bin");
    int h = 1;
    int w = 8;
    float dataIn[] = {-0.882353,-0.145729,0.0819672,-0.414141,0,-0.207153,-0.766866,-0.666667};
    ncnn::Mat in(w,(void*)dataIn);
    // ncnn::Mat in(w,h,(void*)dataIn);
    // ncnn::Mat in(w,h,1,(void*)dataIn);
    ncnn::Mat out;
    ncnn::Extractor ex = net.create_extractor();
    ex.set_light_mode(true);
    ex.input("actual_input_1",in);
    ex.extract("output1",out);

    ncnn::Mat out_flatterned = out.reshape(out.w * out.h * out.c);
    std::vector<float> scores;
    scores.resize(out_flatterned.w);
    for(int i = 0;i < out_flatterned.w; i++){
        scores[i] = out_flatterned[i];
    }

    std::cout << "score is: " << scores[0] << std::endl;

    net.clear();
}
